﻿#设置cmake的最低版本
cmake_minimum_required(VERSION 3.16)

#设置解决方案名称
set(PROJECT_NAME "DesignPatterns_Bridge")
PROJECT( ${PROJECT_NAME} )

#顶层目录${CMAKE_SOURCE_DIR}

#设置输出目录
SET(OUTPUT_PATH ${CMAKE_BINARY_DIR}/OutPut/${CPU})

#CMake变量 CMAKE_RUNTIME_OUTPUT_DIRECTORY_<CONFIG>，用于指定生成的可执行文件的输出目录。
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${OUTPUT_PATH}/Debug)#或${OUTPUT_PATH}/Debug/bin
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_PATH}/Release)#或${OUTPUT_PATH}/Release/bin

#CMake变量 CMAKE_LIBRARY_OUTPUT_DIRECTORY_<CONFIG>，用于指定生成的库文件（例如动态库）的输出目录。
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${OUTPUT_PATH}/Debug)#或${OUTPUT_PATH}/Debug/lib
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_PATH}/Release)#或${OUTPUT_PATH}/Release/lib

#CMake变量 CMAKE_ARCHIVE_OUTPUT_DIRECTORY_<CONFIG>，用于指定生成的归档文件（例如静态库）的输出目录。
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${OUTPUT_PATH}/Debug)#或${OUTPUT_PATH}/Debug/static
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${OUTPUT_PATH}/Release)#或${OUTPUT_PATH}/Release/static

SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(DEBUG_CONFIGURATIONS "Debug")
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)												#CMAKE_CXX_EXTENSIONS设为OFF，禁用扩展标志，按照标准的 C++ 规范进行编译


# 【USE_MP】针对Windows系统，Visual Studio 2005 以上版本，支持多线程编译
IF(WIN32)
	option(USE_MP "Set to ON to build with the /MP option (Visual Studio 2005 and above)." ON)
	MARK_AS_ADVANCED(USE_MP)
	IF(USE_MP)
		SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
	ENDIF(USE_MP)
ENDIF(WIN32)


link_directories(${OUTPUT_PATH})

add_subdirectory(src/segement)
add_subdirectory(src/xian)
add_subdirectory(src/test)